package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class configActivity2 extends AppCompatActivity {
    EditText d_rate,u_rate,w_rate;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_config2);
        d_rate=findViewById(R.id.d_rate);
        u_rate=findViewById(R.id.u_rate);
        w_rate=findViewById(R.id.w_rate);
        Intent intent=getIntent();
        float d1=intent.getFloatExtra("dollar_rate_key",0.0f);
        d_rate.setText(""+d1);
        float u1=intent.getFloatExtra("euro_rate_key",0.0f);
        u_rate.setText(""+u1);
        float w1=intent.getFloatExtra("won_rate_key",0.0f);
        w_rate.setText(""+u1);
    }
    public void click(View v){
        d_rate=findViewById(R.id.d_rate);
        u_rate=findViewById(R.id.u_rate);
        w_rate=findViewById(R.id.w_rate);
        String d=d_rate.getText().toString();
        String u=u_rate.getText().toString();
        String w=w_rate.getText().toString();
        float d_rate=Float.valueOf(d);
        float u_rate=Float.valueOf(u);
        float w_rate=Float.valueOf(w);
        Intent main=new Intent(this,MainActivity.class);
        main.putExtra("new_dollar_rate_key",d_rate);
        main.putExtra("new_euro_rate_key",u_rate);
        main.putExtra("new_won_rate_key",w_rate);
        startActivity(main);
    }
}